import { useRef, useState } from "react";

let tmp

const App = () => {
    const divRef = useRef();
    const [num, setnum] = useState(1);


    const clickHandler = () => {
        console.log(divRef === tmp);
        
    }
    const add = () => {
        setnum(num+1)
        tmp = divRef
    }
    return <div>
        {num}
        <br/>
        <div ref = {divRef}>
           <button onClick={clickHandler}>+1</button>
           <button onClick={add}>++++</button>
        </div>
    </div>
};

export default App;
